<template>
  <router-view v-slot="{ Component }" v-if="updateKey">
    <component :is="Component" />
  </router-view>
</template>

<script setup lang="ts">
import { ref, onMounted, watch, nextTick } from 'vue'
import { useStore } from '@/store'
const store = useStore()
onMounted(() => {
  // 加载主题样式
  document.documentElement.style.cssText = store.state.global.systemStyle
})
const updateKey = ref(1)

watch(
  () => store.state.i18n.language,
  () => {
    nextTick(() => {
      updateKey.value++
    })
  }
)
</script>

<style lang="scss">
#app {
  margin: 0 auto;
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: #666;
}
</style>
